include SOURCES

BACKUP_DIR := ../backup
SRC :=$(foreach DIR,$(SRC_DIR),$(wildcard $(DIR)/*.cpp) $(wildcard $(DIR)/*.c))
SRC_DIR_WITHOUT_UP :=$(patsubst ../%,%,$(SRC_DIR))

BACKUP_DIR_ORDER :=$(foreach DIR,$(SRC_DIR_WITHOUT_UP), $(subst /,\, $(BACKUP_DIR)/$(DIR)))
BACKUP_FILES :=$(patsubst ../%.c, $(BACKUP_DIR)/%.back, \
				$(patsubst ../%.cpp, $(BACKUP_DIR)/%.bak, $(SRC)))

MKDIRS := $(BACKUP_DIR_ORDER)
MKDIRS := $(sort $(MKDIRS))

all: $(BACKUP_FILES)

$(BACKUP_FILES): environment

$(BACKUP_DIR)/%.bak: ../%.c
	@perl add_traces.pl  $< $@
$(BACKUP_DIR)/%.bak: ../%.cpp
	@perl add_traces.pl  $< $@

environment: 
	@CMD /C FOR  %1  IN ($(BACKUP_DIR_ORDER)) DO CMD /C IF NOT EXIST %1 MKDIR %1
	echo SRC:$(SRC)

do_nothing:
	@rem do nothing

MAKMAKE :  all
	
BLD : do_nothing

CLEAN :

LIB : do_nothing

CLEANLIB : do_nothing

RESOURCE : do_nothing

FREEZE : do_nothing

SAVESPACE : do_nothing

RELEASABLES :

FINAL : do_nothing
